-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 3430 - new packagings edit page based on api v3 #3475
feat: 3430 - new packagings edit page based on api v3 #3475
Conversation
New file: * `edit_new_packagings.dart`: Edit display of a product packagings (the new api V3 version). Impacted files: * `background_task_details.dart`: added specific save method call for api V3 * `edit_product_page.dart`: added call to new page `EditNewPackagings` * `ocr_packaging_helper.dart`: minor unrelated refactoring * `paged_user_product_query.dart`: specific field list * `product_query.dart`: upgraded to api V3; added field `PACKAGINGS`; added specific field list for user-related searches (they do not support `PACKAGINGS`) * `product_refresher.dart`: upgraded to api V3 * `simple_input_page.dart`: minor refactoring * `simple_input_widget.dart`: refactoring about making the autocomplete widget reusable * `up_to_date_changes.dart`: added new field `packagings`; minor unrelated refactoring
Great for the quick turnaround @monsieurtanuki 👏 |
Codecov Report
@@ Coverage Diff @@
## develop #3475 +/- ##
===========================================
- Coverage 11.23% 11.09% -0.15%
===========================================
Files 261 262 +1
Lines 12670 12830 +160
===========================================
Hits 1424 1424
- Misses 11246 11406 +160
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
result.status != ProductResultV3.statusWarning) { | ||
throw Exception('Could not save product - ${result.errors}'); | ||
} | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit confused about the return statement here, do you think it's needed here ?
Suppose I am offline now and I did some edits to the product name and then to this packagings
So when I connect back to the internet, the first block ie the code from if condition would run, and then after successful, it would simply return and won't do the save query for the rest of the changes,
Is there something I am missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't merge changes, and just save them sequentially one by one.
In the case we want to save packagings, we are going to save only this field. Therefore only in api v3, and when it's done there's nothing else to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't merge changes, and just save them sequentially one by one.
Thanks for the answer, now it's clear
They are not in off-dart. |
ok @monsieurtanuki, I have filed a task there |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality wise, it's a good first step 👍
Good to merge with a technical review from @AshAman999 or @M123-dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing that worries me here, thanks @monsieurtanuki
} | ||
return; | ||
} | ||
final Status status = await OpenFoodAPIClient.saveProduct( | ||
getUser(), | ||
_product, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we remove the packaging from here, or are they ignored by the older api versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in a previous comment, save v3 can only save packagings, and the other save method can save the rest. So we need both.
Not sure that answers your question, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found some issues with the theme and others but found out you already have todos left for em
I was trying the build on my emulator and found that the focus node, ie keyboard on the new packaging screen can't be dismissed,
Nothing blocking though, it does the job, We can fix these later on
👍 for merge from my side too
getUser(), | ||
_product, | ||
language: getLanguage(), | ||
country: getCountry(), | ||
); | ||
if (status.status != 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @M123-dev
Just out of curiosity, Can / Should we log this into sentry, Just wanted to make sure and keep a look into how many fails we do incur when saving data, would be helpful in understanding the background sync bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Exception will be automatically collected by sentry, but this is to be checked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AshAman999 More broadly, the question is again: what should we do with failing changes? Run them forever? Ignore them? Alert the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking that a alert would be more subtle for now
At least the user will know that something went wrong
About retires I am not sure that we are going to have so many of those occurrences for failures,
I guess next setry report will reveal these data
Thank you guys for the reviews! |
New file:
edit_new_packagings.dart
: Edit display of a product packagings (the new api V3 version).Impacted files:
background_task_details.dart
: added specific save method call for api V3edit_product_page.dart
: added call to new pageEditNewPackagings
ocr_packaging_helper.dart
: minor unrelated refactoringpaged_user_product_query.dart
: specific field listproduct_query.dart
: upgraded to api V3; added fieldPACKAGINGS
; added specific field list for user-related searches (they do not supportPACKAGINGS
)product_refresher.dart
: upgraded to api V3simple_input_page.dart
: minor refactoringsimple_input_widget.dart
: refactoring about making the autocomplete widget reusableup_to_date_changes.dart
: added new fieldpackagings
; minor unrelated refactoringWhat
Screenshot
Fixes bug(s)